<!--详情页面-->
<template>
  <h1>详情页</h1>
  <hr>
  <h1>{{weibo.nickname}} 说了: {{weibo.content}}</h1>
  <p>发布于:{{weibo.created}}</p>
</template>

<script setup>
import {onMounted, ref} from "vue";
import axios from "axios";

const weibo = ref({});
onMounted(()=>{
  //得到url中的id值
  let id = new URLSearchParams(location.search).get('id');
  //alert(id);
  //发请求获取指定id的本条微博的详情
  axios.get('http://localhost:8080/v1/weibos/'+id+'/detail')
      .then((response)=>{
        if(response.data.code==2001){
          weibo.value = response.data.data;
        }
      })
})

</script>

<style scoped>

</style>